// ==UserScript==
// @name          a/base target blank to target self step2
// @author        paul_guo
// @version       1.05
// @include       *.baidu.*
// @include       *qidian.com*
// @namespace     *
// @description   changes a and base target="_blank" to target="_self"
// @grant         none
// @updateURL https://gitee.com/laulguo/personalrule/raw/master/target%20blank%20remove_part_mode/%20target%20blank%20to%20target%20self%20step2.user.js
// Based on earlier script by sameagain and Richard Pratt
// ==/UserScript==
var a=document.getElementsByTagName('a'),
base=document.getElementsByTagName('base');
const interval = setInterval(function(){
for (i=0;i<base.length;i++)
 if (base[i].getAttribute('target')=='_blank')
  base[i].setAttribute('target','_self');
for (i=0;i<a.length;i++)
 if (a[i].getAttribute('target')=='_blank')
  a[i].setAttribute('target','_self');
}, 100);

// 定时结束
setTimeout(() => {
    clearInterval(interval )
}, 30000);